//
//  QRCodeViewController.swift
//  ZYBWeibo
//
//  Created by xthink4 on 16/3/9.
//  Copyright © 2016年 zyb. All rights reserved.
//

import UIKit

class QRCodeViewController: UIViewController {
    
    @IBOutlet weak var hight_contraint: NSLayoutConstraint!
    
    @IBOutlet weak var line_top_constraint: NSLayoutConstraint!
    ///关闭二维码
    @IBAction func closeQRCode(sender: UIBarButtonItem) {
        self.dismissViewControllerAnimated(true, completion: nil)
    }

    ///打开相册
    @IBAction func openPhoto(sender: AnyObject) {
        
    }
    override func viewDidLoad() {
        super.viewDidLoad()

       
    }
    
    override func viewDidAppear(animated: Bool) {
        super.viewDidAppear(animated)
        QRCode_Animation()//动画要在试图出现后执行
    }
    //MARK:--二维码扫描动画
    ///二维码动画（通过更感约束来实现动画效果）
    private func QRCode_Animation(){
        line_top_constraint.constant = -hight_contraint.constant
        view.layoutIfNeeded()
        UIView.animateWithDuration(2.0) { () -> Void in
            //设置动画永无止境的重复
            UIView.setAnimationRepeatCount(MAXFLOAT)
            self.line_top_constraint.constant=self.hight_contraint.constant
            self.view.layoutIfNeeded()
            print(self.line_top_constraint.constant)
        }
    }
//MARK:--二维码扫描
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

   
}
